<template>
  <el-config-provider :locale="locale">
    <router-view />
  </el-config-provider>
</template>
<script setup lang="ts">
import { useTheme } from '@/hooks'
import { useAppStore } from '@/stores'
import en from 'element-plus/es/locale/lang/en'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import { LanguageEnum } from '@/constants'

const { initTheme } = useTheme()
initTheme()
const appStore = useAppStore()

const locale = computed(() => {
  if (appStore.getLanguage === LanguageEnum.ZH_CN) return zhCn
  if (appStore.getLanguage === LanguageEnum.EN) return en
})
</script>
<style scoped></style>
